<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.global.js"></script>
    <!-- 引入axios -->
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>

<body>
    <div id="app">


    </div>
</body>

</html>
<script>

    // 设置axios 的默认配置
    axios.defaults.baseURL = 'http://kumanxuan1.f3322.net:8001';
    axios.defaults.headers.common['token'] = 'qqqqweqwe13213213213';
    axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';


    const app = Vue.createApp({
        data() {
            return {

            }
        },
        methods: {

        },
        created() {
            // 首页的请求
            axios.get('/index/index').then(res => {
                console.log(1, res);
            })

            // 分类页请求
            axios({
                method: 'get',
                url: '/topic/list',
                params: {
                    page: 2,
                    size: 10
                }
            }).then(res => {
                console.log(2, res);
            });
            // 登录请求
            axios({
                url: '/auth/loginByWeb',
                method: 'post',
                data: {
                    pwd: "123123",
                    username: "小月月"
                },
                // headers: {
                //     'Content-Type': 'application/json'
                // }

            }).then(res => {
                console.log(res);
            })
        }
    }).mount('#app')

</script>